/*
 * Copyright (C) 2012 The Yuike Mobile Develop Common Framework Project
 *
 * YkAnimationStep.h
 * 
 * @brief: 		动画播放的类
 * 
 * @author   	wanggang
 * @date     	2012-1-5
 */

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>


typedef void (^AnimationStep)(void);


@interface YkAnimationStep : NSObject
{
    NSTimeInterval delay;
    NSTimeInterval duration;
    AnimationStep step;
    UIViewAnimationOptions options;
    NSMutableArray* consumableSteps;
}


#pragma mark - properties

@property (nonatomic, assign) NSTimeInterval delay;
@property (nonatomic, assign) NSTimeInterval duration;
@property (nonatomic, copy) AnimationStep step;
@property (nonatomic, assign) UIViewAnimationOptions options;
@property (nonatomic, retain) NSMutableArray* consumableSteps;

/**
 * @brief:	实例化对象
 * @param   delay  延迟多久运行
 * @param   step   播放的动画效果
 * @return  id 	实例化后的对象	  
 * @note 
 */
+ (id) after:(NSTimeInterval)delay
	 animate:(AnimationStep)step;


/**
 * @brief:	实例化对象
 * @param   duration  运行多久运行
 * @param   step   播放的动画效果
 * @return  id 	实例化后的对象	  
 * @note 
 */
+ (id) for:(NSTimeInterval)duration
animate:(AnimationStep)step;

/**
 * @brief:	实例化对象
 * @param   duration  运行多久运行
 * @param   step   播放的动画效果
* @param   theOptions  动画的参数
 * @return  id 	实例化后的对象	  
 * @note 
 */
+ (id) for:(NSTimeInterval)duration 
options:(UIViewAnimationOptions)theOptions 
animate:(AnimationStep)step;
/**
 * @brief:	实例化对象
 * @param   delay  延迟多久运行
 * @param   duration  运行多久运行
 * @param   step   播放的动画效果
 * @return  id 	实例化后的对象	  
 * @note 
 */
+ (id) after:(NSTimeInterval)delay
for:(NSTimeInterval)duration
animate:(AnimationStep)step;


/**
 * @brief:	实例化对象
 * @param   delay  延迟多久运行
 * @param   duration  运行多久运行
 * @param   theOptions  动画的参数
 * @param   step   播放的动画效果
 * @return  id 	实例化后的对象	  
 * @note 
 */
+ (id) after:(NSTimeInterval)delay
for:(NSTimeInterval)duration
options:(UIViewAnimationOptions)theOptions
animate:(AnimationStep)step;


#pragma mark - execution

/**
 * @brief:	运行动画
 * @param   animated  是否有动画效果
 * @return  	  
 * @note 
 */
- (void) runAnimated:(BOOL)animated;

/**
 * @brief:	运行动画 有动画效果
 * @return  	  
 * @note 
 */
- (void) runAnimation;
@end
